<a href="http://github.com/angular/angular.js/tree/v1.2.12/src/ngMock/angular-mocks.js#L437" class="view-source btn btn-action"><i class="icon-zoom-in"> </i> View source</a><a href="http://github.com/angular/angular.js/edit/master/src/ngMock/angular-mocks.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$interval</code>
<div><span class="hint">service in module <code ng:non-bindable="">ngMock</code>
</span>
</div>
</h1>
<div><h2 id="description">Description</h2>
<div class="description"><div class="ngmock-interval-page"><p>Mock implementation of the $interval service.</p>
<p>Use <a href="api/ngMock.$interval#methods_flush"><code>$interval.flush(millis)</code></a> to
move forward by <code>millis</code> milliseconds and trigger any functions scheduled to run in that
time.</p>
</div></div>
<h2 id="usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">$interval(fn, delay[, count][, invokeApply]);</pre>
<h4 id="usage_parameters">Parameters</h4><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>fn</td><td><a href="" class="label type-hint type-hint-function">function()</a></td><td><div class="ngmock-interval-page"><p>A function that should be called repeatedly.</p>
</div></td></tr><tr><td>delay</td><td><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="ngmock-interval-page"><p>Number of milliseconds between each function call.</p>
</div></td></tr><tr><td>count <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="ngmock-interval-page"><p>Number of times to repeat. If not set, or 0, will repeat
indefinitely.</p>
</div> <p><em>(default: 0)</em></p></td></tr><tr><td>invokeApply <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="ngmock-interval-page"><p>If set to <code>false</code> skips model dirty checking, otherwise
will invoke <code>fn</code> within the <a href="api/ng.$rootScope.Scope#methods_$apply"><code>$apply</code></a> block.</p>
</div> <p><em>(default: true)</em></p></td></tr></tbody></table><h4 id="usage_returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-promise">promise</a></td><td><div class="ngmock-interval-page"><p>A promise which will be notified on each iteration.</p>
</div></td></tr></table></div>
<div class="member method"><h2 id="methods">Methods</h2>
<ul class="methods"><li><h3 id="methods_flush">flush(millis)</h3>
<div class="flush"><div class="ngmock-interval-flush-page"><p>Runs interval tasks scheduled to be run in the next <code>millis</code> milliseconds.</p>
</div><h5 id="methods_flush_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>millis <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="ngmock-interval-flush-page"><p>maximum timeout amount to flush up until.</p>
</div></td></tr></tbody></table><h5 id="methods_flush_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="ngmock-interval-flush-page"><p>The amount of time moved forward.</p>
</div></td></tr></table></div>
</li>
</ul>
</div>
</div>
